from common.base import BasePage
from selenium.common.exceptions import NoSuchElementException
from common.base import logger, Util
import time

class LoginPage(BasePage):
    username = ('xpath','//*[@id="myform"]/div[1]/div/input')
    password = ('xpath','//*[@id="myform"]/div[2]/div/input')

    def login_action(self, un, pw):
        logger.info('==========输入密码'.format(un))
        self.send_keys(self.username, un)
        logger.info('==========输入密码'.format(pw))
        self.send_keys(self.password, pw)

        # 截图
        now = time.strftime('%Y-%m-%d %H %M %S')
        Util.get_screenshot(self.driver, Util.get_conf()['screenshouPath'+now+'png'])



